﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using BusinessLayer.RegInfo.Entities;
using DBHelper;

namespace BusinessLayer.RegInfo
{
    public class TB_Artist_HomeBL
    {
        public TB_Artist_Home GetRandomArtistHome()
        {
            TB_Artist_Home result = new TB_Artist_Home();

            var adapter = new BaseDAO(DbConfig.DbRegInfoConnectionString);           
            try
            {
                result = adapter.GetList<TB_Artist_Home>("sp_TB_Artist_Home_GetRandomArtistHome", CommandType.StoredProcedure, CustomConnectionState.CloseOnExit).FirstOrDefault();                
            }
            catch (Exception)
            {
            }
            finally { adapter.Dispose(); }
            return result;
        }

        public TB_Artist_Home GetById(int id)
        {
            TB_Artist_Home result = new TB_Artist_Home();

            var adapter = new BaseDAO(DbConfig.DbRegInfoConnectionString);
            adapter.AddParameter("@Id", id);
            try
            {
                result = adapter.GetList<TB_Artist_Home>("sp_TB_Artist_Home_GetById", CommandType.StoredProcedure, CustomConnectionState.CloseOnExit).FirstOrDefault();
            }
            catch (Exception)
            {
            }
            finally { adapter.Dispose(); }
            return result;
        }
    }
}
